package com.songshuai.webapi.permission.service.impl;

import com.songshuai.webapi.baseapi.utils.PropertiesUtil;
import com.songshuai.webapi.permission.dao.YxClientMapper;
import com.songshuai.webapi.permission.dto.response.ClientListResDto;
import com.songshuai.webapi.permission.model.YxClient;
import com.songshuai.webapi.permission.service.ClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class ClientServiceImpl implements ClientService {

    @Autowired
    private YxClientMapper yxClientMapper;

    @Override
    public List<ClientListResDto> queryAppList() {
        List<YxClient> yxClientList = yxClientMapper.queryAppList();
        List<ClientListResDto> result = new ArrayList<>();
        for(YxClient yxClient:yxClientList){
            ClientListResDto clientListResDto = new ClientListResDto();
            PropertiesUtil.copyProperties(yxClient,clientListResDto);
            result.add(clientListResDto);
        }
        return result;
    }
}